package com.xinbochuang.machine.admin.domain.system;

import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xinbochuang.machine.common.annotation.Excel;
import com.xinbochuang.machine.common.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * 入库一级清单
 *
 * @author 黄晓鹏
 * @date 2020-09-30
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("SYS_STOREHOUSE")
@KeySequence(value = "SYS_STOREHOUSE_SEQ", clazz = Integer.class)
public class SysStorehouse extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @TableId("ID")
    @Excel(name = "主键id", height = 20)
    private Integer id;

    /**
     * 部门id
     */
    @TableField("DEPT_ID")
    private Integer deptId;

    /**
     * 部门名称
     */
    @TableField("DEPT_NAME")
    @Excel(name = "部门名称", height = 20)
    private String deptName;

    /**
     * 出库人id
     */
    @TableField("USER_ID")
    private Integer userId;

    /**
     * 出库人名称
     */
    @TableField("USER_NAME")
    @Excel(name = "入库人", height = 20)
    private String userName;

    /**
     * 入库信息id
     */
    @TableField("IN_ID")
    private Integer inId;

    /**
     * 物品名称
     */
    @TableField("NAME")
    @Excel(name = "物品名称", height = 20)
    private String name;

    /**
     * 规格型号
     */
    @TableField("MODEL")
    @Excel(name = "规格型号", height = 20)
    private String model;

    /**
     * 单位id（字典：sys_storehouse_unit）
     */
    @TableField("UNIT_ID")
    private Integer unitId;

    /**
     * 生成码
     */
    @TableField("CODE")
    private String code;

    /**
     * 出库去向
     */
    @TableField("OUT_PLACE")
    private String outPlace;

    /**
     * 出库时间
     */
    @TableField("OUT_TIME")
    private String outTime;

    /**
     * 状态（字典：sys_storehouse_status
     */
    @TableField("STATUS")
    private String status;

    @TableField("STORAGE_RACK_ID")
    private String storageRackId;

    @TableField("STORAGE_RACK_POSITION")
    private String storageRackPosition;

    /**
     * 单位名称
     */
    @TableField(exist = false)
    private String unitName;

    /**
     * 数量
     */
    @TableField(exist = false)
    @Excel(name = "数量", height = 20)
    private String num;

    /**
     * 状态文字
     */
    @TableField(exist = false)
    @Excel(name = "状态", height = 20)
    private String dictLabel;

    /**
     * 入库时间
     */
    @TableField("IN_TIME")
    @Excel(name = "入库时间", height = 20)
    private String inTime;

    /**
     * 实物是否存在（Y 存在 N 不存在）
     */
    @TableField("IS_EXIST")
    @Excel(name = "实物是否存在", height = 20)
    private String isExist;

    /**
     * 库存位置
     */
    @TableField(exist = false)
    @Excel(name = "库存位置", height = 20)
    private String storageRackName;

    /**
     * 二级清单
     */
    @TableField(exist = false)
    private List<SysStorehouseSecond> sysStorehouseSecondList;

    /**
     * 二级清单列表
     */
    @TableField(exist = false)
    private List<SysStorehouseSecond> children;

    public SysStorehouse() {
    }

    public SysStorehouse(SysStorehouseIn storehouseIn) {
        this.deptId = storehouseIn.getDeptId();
        this.deptName = storehouseIn.getDeptName();
        this.userId = storehouseIn.getUserId();
        this.userName = storehouseIn.getUserName();
        this.inId = storehouseIn.getInId();
        this.name = storehouseIn.getName();
        this.model = storehouseIn.getModel();
        this.unitId = storehouseIn.getUnitId();
        this.code = storehouseIn.getCode();
        this.children = storehouseIn.getChildren();
    }
}
